package cn.tedu.luban.order.main.repository;

import cn.tedu.luban.order.main.converter.OrderLogConverter;
import cn.tedu.luban.order.main.dao.OrderLogDAO;
import cn.tedu.luban.order.protocol.bo.OrderLogBO;
import cn.tedu.luban.order.protocol.dos.OrderLogDO;
import cn.tedu.luban.order.protocol.param.OrderLogParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public class OrderLogRepoImpl implements OrderLogRepository{

    @Autowired
    private OrderLogDAO orderLogDAO;
    @Autowired
    private OrderLogConverter orderLogConverter;

    @Override
    public List<OrderLogBO> getOrderLogByOrderNo(String no) {
        List<OrderLogDO> dos = orderLogDAO.getOrderLogByOrderNo(no);
        return orderLogConverter.dos2bos(dos);
    }

    @Override
    public void saveOrderLog(OrderLogParam param) {
        OrderLogDO orderLogDO = orderLogConverter.param2do(param);
        orderLogDAO.saveOrderLog(orderLogDO);

    }
}
